if (typeof Date.add == 'undefined') {
	// 加减时间的字段
	Date.Year = 0;
	Date.Month = 1;
	Date.Day = 2;
	Date.Hour = 3;
	Date.Minute = 4;
	Date.Second = 5;
	/**
	 * 加减时间
	 */
	Date.prototype.add = function(field, amount) {
		switch (field) {
		case 0:
			this.setFullYear(this.getFullYear() + amount);
			break;
		case 1:
			this.setMonth(this.getMonth() + amount);
			break;
		case 2:
			this.setDay(this.getDay() + amount);
			break;
		case 3:
			this.setHours(this.getHours() + amount);
			break;
		case 4:
			this.setMinutes(this.getMinutes() + amount);
			break;
		case 5:
			this.setSeconds(this.getSeconds() + amount);
			break;
		default:
			break;
		}
	}
}
/**
 * 是否是闰年
 */
Date.prototype.isLeapYear = function() {
	return ((this.getYear() % 4 == 0 && this.getYear() % 100 != 0) || this
			.getYear() % 400 == 0)
}

/**
 * 格式化时间<br />
 * eg: 
 * new Date().format('yyyy-MM-dd HH:mm:ss')//2009-10-19 16:21:30
 * new Date().format('yyyy-MM-dd E HH:mm:ss')//2009-10-19 一 16:21:30
 * new Date().format('yyyy-MM-dd EE HH:mm:ss')//2009-10-19 周一 16:21:30
 * new Date().format('yyyy-MM-dd EEE HH:mm:ss')//2009-10-19 星期一 16:21:30
 */
Date.prototype.format = function(format) {
	var o = {
		"M+" :this.getMonth() + 1, // month
		"d+" :this.getDate(), // day
		"H+" :this.getHours(), // hour
		"m+" :this.getMinutes(), // minute
		"s+" :this.getSeconds(), // second
		"q+" :Math.floor((this.getMonth() + 3) / 3), // quarter
		"S" :this.getMilliseconds()
	// millisecond
	}
	var week = {
		"0" :"\u65e5",
		"1" :"\u4e00",
		"2" :"\u4e8c",
		"3" :"\u4e09",
		"4" :"\u56db",
		"5" :"\u4e94",
		"6" :"\u516d"
	};
	if (/(y+)/.test(format))
		format = format.replace(RegExp.$1, (this.getFullYear() + "")
				.substr(4 - RegExp.$1.length));
	if (/(E+)/.test(format))
		format = format.replace(
						RegExp.$1,
						((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "\u661f\u671f"
								: "\u5468")
								: "")
								+ week[this.getDay() + ""]);
	for ( var k in o)
		if (new RegExp("(" + k + ")").test(format))
			format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]
					: ("00" + o[k]).substr(("" + o[k]).length));
	return format;
}

/**
 * 格式化字符串<br />
 * eg:String.format('{0}! {1},how are you?','hello','lucy');//hello! lucy,how
 * are you?
 */
String.format = function() {
	if (arguments.length == 0)
		return null;
	var s = arguments[0];
	for ( var i = 1; i < arguments.length; i++) {
		var re = new RegExp('\\{' + (i - 1) + '\\}', 'gm');
		s = s.replace(re, arguments[i]);
	}
	return s;
}
String.prototype.toDate = function(style) {
	if (style == null)
		style = 'yyyy-MM-dd hh:mm:ss';
	var o = {
		'y+' :'y',
		'M+' :'M',
		'd+' :'d',
		'h+' :'h',
		'm+' :'m',
		's+' :'s'
	}
	var result = {
		'y' :'',
		'M' :'',
		'd' :'',
		'h' :'00',
		'm' :'00',
		's' :'00'
	}
	var tmp = style;
	for ( var k in o) {
		if (new RegExp('(' + k + ')').test(style)) {
			result[o[k]] = this.substring(tmp.indexOf(RegExp.$1), tmp
					.indexOf(RegExp.$1)
					+ RegExp.$1.length);
		}
	}
	return new Date(result['y'], result['M'] - 1, result['d'], result['h'],
			result['m'], result['s']);
};

String.prototype.Trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, '')
}
String.prototype.LTrim = function() {
	return this.replace(/(^\s*)/g, '')
}
String.prototype.RTrim = function() {
	return this.replace(/(\s*$)/g, '')
}
function CallOpenerOrParentMethod(name, params) {
	if (window.parent == this) {
		eval('window.opener.' + name + '(' + params + ');');
	} else {
		eval('window.parent.' + name + '(' + params + ');');
	}
}

function setSelectData(data,value){
	
}